package com.xjgzinfo.usdp.web.rest;

import com.xjgzinfo.usdp.AvueServer4jApp;
import com.xjgzinfo.usdp.config.TestSecurityConfiguration;
import com.xjgzinfo.usdp.domain.AppClass;
import com.xjgzinfo.usdp.domain.WebConfig;
import com.xjgzinfo.usdp.domain.PageSchema;
import com.xjgzinfo.usdp.domain.ProjectClass;
import com.xjgzinfo.usdp.repository.AppClassRepository;
import com.xjgzinfo.usdp.service.AppClassService;
import com.xjgzinfo.usdp.service.dto.AppClassDTO;
import com.xjgzinfo.usdp.service.mapper.AppClassMapper;
import com.xjgzinfo.usdp.service.dto.AppClassCriteria;
import com.xjgzinfo.usdp.service.AppClassQueryService;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Base64Utils;
import javax.persistence.EntityManager;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;

/**
 * Integration tests for the {@link AppClassResource} REST controller.
 */
@SpringBootTest(classes = { AvueServer4jApp.class, TestSecurityConfiguration.class })
@AutoConfigureMockMvc
@WithMockUser
public class AppClassResourceIT {

    private static final String DEFAULT_COMMENT = "AAAAAAAAAA";
    private static final String UPDATED_COMMENT = "BBBBBBBBBB";

    private static final String DEFAULT_NAME = "AAAAAAAAAA";
    private static final String UPDATED_NAME = "BBBBBBBBBB";

    private static final String DEFAULT_STATUS = "AAAAAAAAAA";
    private static final String UPDATED_STATUS = "BBBBBBBBBB";

    private static final Boolean DEFAULT_ENABLE_SYSTEM_TABLE = false;
    private static final Boolean UPDATED_ENABLE_SYSTEM_TABLE = true;

    private static final Long DEFAULT_X = 20L;
    private static final Long UPDATED_X = 19L;
    private static final Long SMALLER_X = 20L - 1L;

    private static final Long DEFAULT_Y = 20L;
    private static final Long UPDATED_Y = 19L;
    private static final Long SMALLER_Y = 20L - 1L;

    private static final String DEFAULT_DESCRIPTION = "AAAAAAAAAA";
    private static final String UPDATED_DESCRIPTION = "BBBBBBBBBB";

    private static final Long DEFAULT_TENANT_ID = 1L;
    private static final Long UPDATED_TENANT_ID = 2L;
    private static final Long SMALLER_TENANT_ID = 1L - 1L;

    private static final String DEFAULT_CREATE_USER = "AAAAAAAAAA";
    private static final String UPDATED_CREATE_USER = "BBBBBBBBBB";

    private static final String DEFAULT_UPDATE_USER = "AAAAAAAAAA";
    private static final String UPDATED_UPDATE_USER = "BBBBBBBBBB";

    private static final Instant DEFAULT_CREATE_TIME = Instant.ofEpochMilli(0L);
    private static final Instant UPDATED_CREATE_TIME = Instant.now().truncatedTo(ChronoUnit.MILLIS);

    private static final Instant DEFAULT_UPDATE_TIME = Instant.ofEpochMilli(0L);
    private static final Instant UPDATED_UPDATE_TIME = Instant.now().truncatedTo(ChronoUnit.MILLIS);

    private static final Boolean DEFAULT_ENABLED = false;
    private static final Boolean UPDATED_ENABLED = true;

    @Autowired
    private AppClassRepository appClassRepository;

    @Autowired
    private AppClassMapper appClassMapper;

    @Autowired
    private AppClassService appClassService;

    @Autowired
    private AppClassQueryService appClassQueryService;

    @Autowired
    private EntityManager em;

    @Autowired
    private MockMvc restAppClassMockMvc;

    private AppClass appClass;

    /**
     * Create an entity for this test.
     *
     * This is a static method, as tests for other entities might also need it,
     * if they test an entity which requires the current entity.
     */
    public static AppClass createEntity(EntityManager em) {
        AppClass appClass = new AppClass()
            .comment(DEFAULT_COMMENT)
            .name(DEFAULT_NAME)
            .status(DEFAULT_STATUS)
            .enableSystemTable(DEFAULT_ENABLE_SYSTEM_TABLE)
            .x(DEFAULT_X)
            .y(DEFAULT_Y)
            .description(DEFAULT_DESCRIPTION)
            .tenantId(DEFAULT_TENANT_ID)
            .createUser(DEFAULT_CREATE_USER)
            .updateUser(DEFAULT_UPDATE_USER)
            .createTime(DEFAULT_CREATE_TIME)
            .updateTime(DEFAULT_UPDATE_TIME)
            .enabled(DEFAULT_ENABLED);
        return appClass;
    }
    /**
     * Create an updated entity for this test.
     *
     * This is a static method, as tests for other entities might also need it,
     * if they test an entity which requires the current entity.
     */
    public static AppClass createUpdatedEntity(EntityManager em) {
        AppClass appClass = new AppClass()
            .comment(UPDATED_COMMENT)
            .name(UPDATED_NAME)
            .status(UPDATED_STATUS)
            .enableSystemTable(UPDATED_ENABLE_SYSTEM_TABLE)
            .x(UPDATED_X)
            .y(UPDATED_Y)
            .description(UPDATED_DESCRIPTION)
            .tenantId(UPDATED_TENANT_ID)
            .createUser(UPDATED_CREATE_USER)
            .updateUser(UPDATED_UPDATE_USER)
            .createTime(UPDATED_CREATE_TIME)
            .updateTime(UPDATED_UPDATE_TIME)
            .enabled(UPDATED_ENABLED);
        return appClass;
    }

    @BeforeEach
    public void initTest() {
        appClass = createEntity(em);
    }

    @Test
    @Transactional
    public void createAppClass() throws Exception {
        int databaseSizeBeforeCreate = appClassRepository.findAll().size();
        // Create the AppClass
        AppClassDTO appClassDTO = appClassMapper.toDto(appClass);
        restAppClassMockMvc.perform(post("/api/app-classes").with(csrf())
            .contentType(MediaType.APPLICATION_JSON)
            .content(TestUtil.convertObjectToJsonBytes(appClassDTO)))
            .andExpect(status().isCreated());

        // Validate the AppClass in the database
        List<AppClass> appClassList = appClassRepository.findAll();
        assertThat(appClassList).hasSize(databaseSizeBeforeCreate + 1);
        AppClass testAppClass = appClassList.get(appClassList.size() - 1);
        assertThat(testAppClass.getComment()).isEqualTo(DEFAULT_COMMENT);
        assertThat(testAppClass.getName()).isEqualTo(DEFAULT_NAME);
        assertThat(testAppClass.getStatus()).isEqualTo(DEFAULT_STATUS);
        assertThat(testAppClass.isEnableSystemTable()).isEqualTo(DEFAULT_ENABLE_SYSTEM_TABLE);
        assertThat(testAppClass.getX()).isEqualTo(DEFAULT_X);
        assertThat(testAppClass.getY()).isEqualTo(DEFAULT_Y);
        assertThat(testAppClass.getDescription()).isEqualTo(DEFAULT_DESCRIPTION);
        assertThat(testAppClass.getTenantId()).isEqualTo(DEFAULT_TENANT_ID);
        assertThat(testAppClass.getCreateUser()).isEqualTo(DEFAULT_CREATE_USER);
        assertThat(testAppClass.getUpdateUser()).isEqualTo(DEFAULT_UPDATE_USER);
        assertThat(testAppClass.getCreateTime()).isEqualTo(DEFAULT_CREATE_TIME);
        assertThat(testAppClass.getUpdateTime()).isEqualTo(DEFAULT_UPDATE_TIME);
        assertThat(testAppClass.isEnabled()).isEqualTo(DEFAULT_ENABLED);
    }

    @Test
    @Transactional
    public void createAppClassWithExistingId() throws Exception {
        int databaseSizeBeforeCreate = appClassRepository.findAll().size();

        // Create the AppClass with an existing ID
        appClass.setId(1L);
        AppClassDTO appClassDTO = appClassMapper.toDto(appClass);

        // An entity with an existing ID cannot be created, so this API call must fail
        restAppClassMockMvc.perform(post("/api/app-classes").with(csrf())
            .contentType(MediaType.APPLICATION_JSON)
            .content(TestUtil.convertObjectToJsonBytes(appClassDTO)))
            .andExpect(status().isBadRequest());

        // Validate the AppClass in the database
        List<AppClass> appClassList = appClassRepository.findAll();
        assertThat(appClassList).hasSize(databaseSizeBeforeCreate);
    }


    @Test
    @Transactional
    public void getAllAppClasses() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList
        restAppClassMockMvc.perform(get("/api/app-classes?sort=id,desc"))
            .andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
            .andExpect(jsonPath("$.[*].id").value(hasItem(appClass.getId().intValue())))
            .andExpect(jsonPath("$.[*].comment").value(hasItem(DEFAULT_COMMENT)))
            .andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME)))
            .andExpect(jsonPath("$.[*].status").value(hasItem(DEFAULT_STATUS)))
            .andExpect(jsonPath("$.[*].enableSystemTable").value(hasItem(DEFAULT_ENABLE_SYSTEM_TABLE.booleanValue())))
            .andExpect(jsonPath("$.[*].x").value(hasItem(DEFAULT_X.intValue())))
            .andExpect(jsonPath("$.[*].y").value(hasItem(DEFAULT_Y.intValue())))
            .andExpect(jsonPath("$.[*].description").value(hasItem(DEFAULT_DESCRIPTION.toString())))
            .andExpect(jsonPath("$.[*].tenantId").value(hasItem(DEFAULT_TENANT_ID.intValue())))
            .andExpect(jsonPath("$.[*].createUser").value(hasItem(DEFAULT_CREATE_USER)))
            .andExpect(jsonPath("$.[*].updateUser").value(hasItem(DEFAULT_UPDATE_USER)))
            .andExpect(jsonPath("$.[*].createTime").value(hasItem(DEFAULT_CREATE_TIME.toString())))
            .andExpect(jsonPath("$.[*].updateTime").value(hasItem(DEFAULT_UPDATE_TIME.toString())))
            .andExpect(jsonPath("$.[*].enabled").value(hasItem(DEFAULT_ENABLED.booleanValue())));
    }
    
    @Test
    @Transactional
    public void getAppClass() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get the appClass
        restAppClassMockMvc.perform(get("/api/app-classes/{id}", appClass.getId()))
            .andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
            .andExpect(jsonPath("$.id").value(appClass.getId().intValue()))
            .andExpect(jsonPath("$.comment").value(DEFAULT_COMMENT))
            .andExpect(jsonPath("$.name").value(DEFAULT_NAME))
            .andExpect(jsonPath("$.status").value(DEFAULT_STATUS))
            .andExpect(jsonPath("$.enableSystemTable").value(DEFAULT_ENABLE_SYSTEM_TABLE.booleanValue()))
            .andExpect(jsonPath("$.x").value(DEFAULT_X.intValue()))
            .andExpect(jsonPath("$.y").value(DEFAULT_Y.intValue()))
            .andExpect(jsonPath("$.description").value(DEFAULT_DESCRIPTION.toString()))
            .andExpect(jsonPath("$.tenantId").value(DEFAULT_TENANT_ID.intValue()))
            .andExpect(jsonPath("$.createUser").value(DEFAULT_CREATE_USER))
            .andExpect(jsonPath("$.updateUser").value(DEFAULT_UPDATE_USER))
            .andExpect(jsonPath("$.createTime").value(DEFAULT_CREATE_TIME.toString()))
            .andExpect(jsonPath("$.updateTime").value(DEFAULT_UPDATE_TIME.toString()))
            .andExpect(jsonPath("$.enabled").value(DEFAULT_ENABLED.booleanValue()));
    }


    @Test
    @Transactional
    public void getAppClassesByIdFiltering() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        Long id = appClass.getId();

        defaultAppClassShouldBeFound("id.equals=" + id);
        defaultAppClassShouldNotBeFound("id.notEquals=" + id);

        defaultAppClassShouldBeFound("id.greaterThanOrEqual=" + id);
        defaultAppClassShouldNotBeFound("id.greaterThan=" + id);

        defaultAppClassShouldBeFound("id.lessThanOrEqual=" + id);
        defaultAppClassShouldNotBeFound("id.lessThan=" + id);
    }


    @Test
    @Transactional
    public void getAllAppClassesByCommentIsEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where comment equals to DEFAULT_COMMENT
        defaultAppClassShouldBeFound("comment.equals=" + DEFAULT_COMMENT);

        // Get all the appClassList where comment equals to UPDATED_COMMENT
        defaultAppClassShouldNotBeFound("comment.equals=" + UPDATED_COMMENT);
    }

    @Test
    @Transactional
    public void getAllAppClassesByCommentIsNotEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where comment not equals to DEFAULT_COMMENT
        defaultAppClassShouldNotBeFound("comment.notEquals=" + DEFAULT_COMMENT);

        // Get all the appClassList where comment not equals to UPDATED_COMMENT
        defaultAppClassShouldBeFound("comment.notEquals=" + UPDATED_COMMENT);
    }

    @Test
    @Transactional
    public void getAllAppClassesByCommentIsInShouldWork() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where comment in DEFAULT_COMMENT or UPDATED_COMMENT
        defaultAppClassShouldBeFound("comment.in=" + DEFAULT_COMMENT + "," + UPDATED_COMMENT);

        // Get all the appClassList where comment equals to UPDATED_COMMENT
        defaultAppClassShouldNotBeFound("comment.in=" + UPDATED_COMMENT);
    }

    @Test
    @Transactional
    public void getAllAppClassesByCommentIsNullOrNotNull() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where comment is not null
        defaultAppClassShouldBeFound("comment.specified=true");

        // Get all the appClassList where comment is null
        defaultAppClassShouldNotBeFound("comment.specified=false");
    }
                @Test
    @Transactional
    public void getAllAppClassesByCommentContainsSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where comment contains DEFAULT_COMMENT
        defaultAppClassShouldBeFound("comment.contains=" + DEFAULT_COMMENT);

        // Get all the appClassList where comment contains UPDATED_COMMENT
        defaultAppClassShouldNotBeFound("comment.contains=" + UPDATED_COMMENT);
    }

    @Test
    @Transactional
    public void getAllAppClassesByCommentNotContainsSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where comment does not contain DEFAULT_COMMENT
        defaultAppClassShouldNotBeFound("comment.doesNotContain=" + DEFAULT_COMMENT);

        // Get all the appClassList where comment does not contain UPDATED_COMMENT
        defaultAppClassShouldBeFound("comment.doesNotContain=" + UPDATED_COMMENT);
    }


    @Test
    @Transactional
    public void getAllAppClassesByNameIsEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where name equals to DEFAULT_NAME
        defaultAppClassShouldBeFound("name.equals=" + DEFAULT_NAME);

        // Get all the appClassList where name equals to UPDATED_NAME
        defaultAppClassShouldNotBeFound("name.equals=" + UPDATED_NAME);
    }

    @Test
    @Transactional
    public void getAllAppClassesByNameIsNotEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where name not equals to DEFAULT_NAME
        defaultAppClassShouldNotBeFound("name.notEquals=" + DEFAULT_NAME);

        // Get all the appClassList where name not equals to UPDATED_NAME
        defaultAppClassShouldBeFound("name.notEquals=" + UPDATED_NAME);
    }

    @Test
    @Transactional
    public void getAllAppClassesByNameIsInShouldWork() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where name in DEFAULT_NAME or UPDATED_NAME
        defaultAppClassShouldBeFound("name.in=" + DEFAULT_NAME + "," + UPDATED_NAME);

        // Get all the appClassList where name equals to UPDATED_NAME
        defaultAppClassShouldNotBeFound("name.in=" + UPDATED_NAME);
    }

    @Test
    @Transactional
    public void getAllAppClassesByNameIsNullOrNotNull() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where name is not null
        defaultAppClassShouldBeFound("name.specified=true");

        // Get all the appClassList where name is null
        defaultAppClassShouldNotBeFound("name.specified=false");
    }
                @Test
    @Transactional
    public void getAllAppClassesByNameContainsSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where name contains DEFAULT_NAME
        defaultAppClassShouldBeFound("name.contains=" + DEFAULT_NAME);

        // Get all the appClassList where name contains UPDATED_NAME
        defaultAppClassShouldNotBeFound("name.contains=" + UPDATED_NAME);
    }

    @Test
    @Transactional
    public void getAllAppClassesByNameNotContainsSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where name does not contain DEFAULT_NAME
        defaultAppClassShouldNotBeFound("name.doesNotContain=" + DEFAULT_NAME);

        // Get all the appClassList where name does not contain UPDATED_NAME
        defaultAppClassShouldBeFound("name.doesNotContain=" + UPDATED_NAME);
    }


    @Test
    @Transactional
    public void getAllAppClassesByStatusIsEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where status equals to DEFAULT_STATUS
        defaultAppClassShouldBeFound("status.equals=" + DEFAULT_STATUS);

        // Get all the appClassList where status equals to UPDATED_STATUS
        defaultAppClassShouldNotBeFound("status.equals=" + UPDATED_STATUS);
    }

    @Test
    @Transactional
    public void getAllAppClassesByStatusIsNotEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where status not equals to DEFAULT_STATUS
        defaultAppClassShouldNotBeFound("status.notEquals=" + DEFAULT_STATUS);

        // Get all the appClassList where status not equals to UPDATED_STATUS
        defaultAppClassShouldBeFound("status.notEquals=" + UPDATED_STATUS);
    }

    @Test
    @Transactional
    public void getAllAppClassesByStatusIsInShouldWork() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where status in DEFAULT_STATUS or UPDATED_STATUS
        defaultAppClassShouldBeFound("status.in=" + DEFAULT_STATUS + "," + UPDATED_STATUS);

        // Get all the appClassList where status equals to UPDATED_STATUS
        defaultAppClassShouldNotBeFound("status.in=" + UPDATED_STATUS);
    }

    @Test
    @Transactional
    public void getAllAppClassesByStatusIsNullOrNotNull() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where status is not null
        defaultAppClassShouldBeFound("status.specified=true");

        // Get all the appClassList where status is null
        defaultAppClassShouldNotBeFound("status.specified=false");
    }
                @Test
    @Transactional
    public void getAllAppClassesByStatusContainsSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where status contains DEFAULT_STATUS
        defaultAppClassShouldBeFound("status.contains=" + DEFAULT_STATUS);

        // Get all the appClassList where status contains UPDATED_STATUS
        defaultAppClassShouldNotBeFound("status.contains=" + UPDATED_STATUS);
    }

    @Test
    @Transactional
    public void getAllAppClassesByStatusNotContainsSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where status does not contain DEFAULT_STATUS
        defaultAppClassShouldNotBeFound("status.doesNotContain=" + DEFAULT_STATUS);

        // Get all the appClassList where status does not contain UPDATED_STATUS
        defaultAppClassShouldBeFound("status.doesNotContain=" + UPDATED_STATUS);
    }


    @Test
    @Transactional
    public void getAllAppClassesByEnableSystemTableIsEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where enableSystemTable equals to DEFAULT_ENABLE_SYSTEM_TABLE
        defaultAppClassShouldBeFound("enableSystemTable.equals=" + DEFAULT_ENABLE_SYSTEM_TABLE);

        // Get all the appClassList where enableSystemTable equals to UPDATED_ENABLE_SYSTEM_TABLE
        defaultAppClassShouldNotBeFound("enableSystemTable.equals=" + UPDATED_ENABLE_SYSTEM_TABLE);
    }

    @Test
    @Transactional
    public void getAllAppClassesByEnableSystemTableIsNotEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where enableSystemTable not equals to DEFAULT_ENABLE_SYSTEM_TABLE
        defaultAppClassShouldNotBeFound("enableSystemTable.notEquals=" + DEFAULT_ENABLE_SYSTEM_TABLE);

        // Get all the appClassList where enableSystemTable not equals to UPDATED_ENABLE_SYSTEM_TABLE
        defaultAppClassShouldBeFound("enableSystemTable.notEquals=" + UPDATED_ENABLE_SYSTEM_TABLE);
    }

    @Test
    @Transactional
    public void getAllAppClassesByEnableSystemTableIsInShouldWork() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where enableSystemTable in DEFAULT_ENABLE_SYSTEM_TABLE or UPDATED_ENABLE_SYSTEM_TABLE
        defaultAppClassShouldBeFound("enableSystemTable.in=" + DEFAULT_ENABLE_SYSTEM_TABLE + "," + UPDATED_ENABLE_SYSTEM_TABLE);

        // Get all the appClassList where enableSystemTable equals to UPDATED_ENABLE_SYSTEM_TABLE
        defaultAppClassShouldNotBeFound("enableSystemTable.in=" + UPDATED_ENABLE_SYSTEM_TABLE);
    }

    @Test
    @Transactional
    public void getAllAppClassesByEnableSystemTableIsNullOrNotNull() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where enableSystemTable is not null
        defaultAppClassShouldBeFound("enableSystemTable.specified=true");

        // Get all the appClassList where enableSystemTable is null
        defaultAppClassShouldNotBeFound("enableSystemTable.specified=false");
    }

    @Test
    @Transactional
    public void getAllAppClassesByXIsEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where x equals to DEFAULT_X
        defaultAppClassShouldBeFound("x.equals=" + DEFAULT_X);

        // Get all the appClassList where x equals to UPDATED_X
        defaultAppClassShouldNotBeFound("x.equals=" + UPDATED_X);
    }

    @Test
    @Transactional
    public void getAllAppClassesByXIsNotEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where x not equals to DEFAULT_X
        defaultAppClassShouldNotBeFound("x.notEquals=" + DEFAULT_X);

        // Get all the appClassList where x not equals to UPDATED_X
        defaultAppClassShouldBeFound("x.notEquals=" + UPDATED_X);
    }

    @Test
    @Transactional
    public void getAllAppClassesByXIsInShouldWork() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where x in DEFAULT_X or UPDATED_X
        defaultAppClassShouldBeFound("x.in=" + DEFAULT_X + "," + UPDATED_X);

        // Get all the appClassList where x equals to UPDATED_X
        defaultAppClassShouldNotBeFound("x.in=" + UPDATED_X);
    }

    @Test
    @Transactional
    public void getAllAppClassesByXIsNullOrNotNull() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where x is not null
        defaultAppClassShouldBeFound("x.specified=true");

        // Get all the appClassList where x is null
        defaultAppClassShouldNotBeFound("x.specified=false");
    }

    @Test
    @Transactional
    public void getAllAppClassesByXIsGreaterThanOrEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where x is greater than or equal to DEFAULT_X
        defaultAppClassShouldBeFound("x.greaterThanOrEqual=" + DEFAULT_X);

        // Get all the appClassList where x is greater than or equal to (DEFAULT_X + 1)
        defaultAppClassShouldNotBeFound("x.greaterThanOrEqual=" + (DEFAULT_X + 1));
    }

    @Test
    @Transactional
    public void getAllAppClassesByXIsLessThanOrEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where x is less than or equal to DEFAULT_X
        defaultAppClassShouldBeFound("x.lessThanOrEqual=" + DEFAULT_X);

        // Get all the appClassList where x is less than or equal to SMALLER_X
        defaultAppClassShouldNotBeFound("x.lessThanOrEqual=" + SMALLER_X);
    }

    @Test
    @Transactional
    public void getAllAppClassesByXIsLessThanSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where x is less than DEFAULT_X
        defaultAppClassShouldNotBeFound("x.lessThan=" + DEFAULT_X);

        // Get all the appClassList where x is less than (DEFAULT_X + 1)
        defaultAppClassShouldBeFound("x.lessThan=" + (DEFAULT_X + 1));
    }

    @Test
    @Transactional
    public void getAllAppClassesByXIsGreaterThanSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where x is greater than DEFAULT_X
        defaultAppClassShouldNotBeFound("x.greaterThan=" + DEFAULT_X);

        // Get all the appClassList where x is greater than SMALLER_X
        defaultAppClassShouldBeFound("x.greaterThan=" + SMALLER_X);
    }


    @Test
    @Transactional
    public void getAllAppClassesByYIsEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where y equals to DEFAULT_Y
        defaultAppClassShouldBeFound("y.equals=" + DEFAULT_Y);

        // Get all the appClassList where y equals to UPDATED_Y
        defaultAppClassShouldNotBeFound("y.equals=" + UPDATED_Y);
    }

    @Test
    @Transactional
    public void getAllAppClassesByYIsNotEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where y not equals to DEFAULT_Y
        defaultAppClassShouldNotBeFound("y.notEquals=" + DEFAULT_Y);

        // Get all the appClassList where y not equals to UPDATED_Y
        defaultAppClassShouldBeFound("y.notEquals=" + UPDATED_Y);
    }

    @Test
    @Transactional
    public void getAllAppClassesByYIsInShouldWork() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where y in DEFAULT_Y or UPDATED_Y
        defaultAppClassShouldBeFound("y.in=" + DEFAULT_Y + "," + UPDATED_Y);

        // Get all the appClassList where y equals to UPDATED_Y
        defaultAppClassShouldNotBeFound("y.in=" + UPDATED_Y);
    }

    @Test
    @Transactional
    public void getAllAppClassesByYIsNullOrNotNull() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where y is not null
        defaultAppClassShouldBeFound("y.specified=true");

        // Get all the appClassList where y is null
        defaultAppClassShouldNotBeFound("y.specified=false");
    }

    @Test
    @Transactional
    public void getAllAppClassesByYIsGreaterThanOrEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where y is greater than or equal to DEFAULT_Y
        defaultAppClassShouldBeFound("y.greaterThanOrEqual=" + DEFAULT_Y);

        // Get all the appClassList where y is greater than or equal to (DEFAULT_Y + 1)
        defaultAppClassShouldNotBeFound("y.greaterThanOrEqual=" + (DEFAULT_Y + 1));
    }

    @Test
    @Transactional
    public void getAllAppClassesByYIsLessThanOrEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where y is less than or equal to DEFAULT_Y
        defaultAppClassShouldBeFound("y.lessThanOrEqual=" + DEFAULT_Y);

        // Get all the appClassList where y is less than or equal to SMALLER_Y
        defaultAppClassShouldNotBeFound("y.lessThanOrEqual=" + SMALLER_Y);
    }

    @Test
    @Transactional
    public void getAllAppClassesByYIsLessThanSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where y is less than DEFAULT_Y
        defaultAppClassShouldNotBeFound("y.lessThan=" + DEFAULT_Y);

        // Get all the appClassList where y is less than (DEFAULT_Y + 1)
        defaultAppClassShouldBeFound("y.lessThan=" + (DEFAULT_Y + 1));
    }

    @Test
    @Transactional
    public void getAllAppClassesByYIsGreaterThanSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where y is greater than DEFAULT_Y
        defaultAppClassShouldNotBeFound("y.greaterThan=" + DEFAULT_Y);

        // Get all the appClassList where y is greater than SMALLER_Y
        defaultAppClassShouldBeFound("y.greaterThan=" + SMALLER_Y);
    }


    @Test
    @Transactional
    public void getAllAppClassesByTenantIdIsEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where tenantId equals to DEFAULT_TENANT_ID
        defaultAppClassShouldBeFound("tenantId.equals=" + DEFAULT_TENANT_ID);

        // Get all the appClassList where tenantId equals to UPDATED_TENANT_ID
        defaultAppClassShouldNotBeFound("tenantId.equals=" + UPDATED_TENANT_ID);
    }

    @Test
    @Transactional
    public void getAllAppClassesByTenantIdIsNotEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where tenantId not equals to DEFAULT_TENANT_ID
        defaultAppClassShouldNotBeFound("tenantId.notEquals=" + DEFAULT_TENANT_ID);

        // Get all the appClassList where tenantId not equals to UPDATED_TENANT_ID
        defaultAppClassShouldBeFound("tenantId.notEquals=" + UPDATED_TENANT_ID);
    }

    @Test
    @Transactional
    public void getAllAppClassesByTenantIdIsInShouldWork() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where tenantId in DEFAULT_TENANT_ID or UPDATED_TENANT_ID
        defaultAppClassShouldBeFound("tenantId.in=" + DEFAULT_TENANT_ID + "," + UPDATED_TENANT_ID);

        // Get all the appClassList where tenantId equals to UPDATED_TENANT_ID
        defaultAppClassShouldNotBeFound("tenantId.in=" + UPDATED_TENANT_ID);
    }

    @Test
    @Transactional
    public void getAllAppClassesByTenantIdIsNullOrNotNull() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where tenantId is not null
        defaultAppClassShouldBeFound("tenantId.specified=true");

        // Get all the appClassList where tenantId is null
        defaultAppClassShouldNotBeFound("tenantId.specified=false");
    }

    @Test
    @Transactional
    public void getAllAppClassesByTenantIdIsGreaterThanOrEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where tenantId is greater than or equal to DEFAULT_TENANT_ID
        defaultAppClassShouldBeFound("tenantId.greaterThanOrEqual=" + DEFAULT_TENANT_ID);

        // Get all the appClassList where tenantId is greater than or equal to UPDATED_TENANT_ID
        defaultAppClassShouldNotBeFound("tenantId.greaterThanOrEqual=" + UPDATED_TENANT_ID);
    }

    @Test
    @Transactional
    public void getAllAppClassesByTenantIdIsLessThanOrEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where tenantId is less than or equal to DEFAULT_TENANT_ID
        defaultAppClassShouldBeFound("tenantId.lessThanOrEqual=" + DEFAULT_TENANT_ID);

        // Get all the appClassList where tenantId is less than or equal to SMALLER_TENANT_ID
        defaultAppClassShouldNotBeFound("tenantId.lessThanOrEqual=" + SMALLER_TENANT_ID);
    }

    @Test
    @Transactional
    public void getAllAppClassesByTenantIdIsLessThanSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where tenantId is less than DEFAULT_TENANT_ID
        defaultAppClassShouldNotBeFound("tenantId.lessThan=" + DEFAULT_TENANT_ID);

        // Get all the appClassList where tenantId is less than UPDATED_TENANT_ID
        defaultAppClassShouldBeFound("tenantId.lessThan=" + UPDATED_TENANT_ID);
    }

    @Test
    @Transactional
    public void getAllAppClassesByTenantIdIsGreaterThanSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where tenantId is greater than DEFAULT_TENANT_ID
        defaultAppClassShouldNotBeFound("tenantId.greaterThan=" + DEFAULT_TENANT_ID);

        // Get all the appClassList where tenantId is greater than SMALLER_TENANT_ID
        defaultAppClassShouldBeFound("tenantId.greaterThan=" + SMALLER_TENANT_ID);
    }


    @Test
    @Transactional
    public void getAllAppClassesByCreateUserIsEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where createUser equals to DEFAULT_CREATE_USER
        defaultAppClassShouldBeFound("createUser.equals=" + DEFAULT_CREATE_USER);

        // Get all the appClassList where createUser equals to UPDATED_CREATE_USER
        defaultAppClassShouldNotBeFound("createUser.equals=" + UPDATED_CREATE_USER);
    }

    @Test
    @Transactional
    public void getAllAppClassesByCreateUserIsNotEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where createUser not equals to DEFAULT_CREATE_USER
        defaultAppClassShouldNotBeFound("createUser.notEquals=" + DEFAULT_CREATE_USER);

        // Get all the appClassList where createUser not equals to UPDATED_CREATE_USER
        defaultAppClassShouldBeFound("createUser.notEquals=" + UPDATED_CREATE_USER);
    }

    @Test
    @Transactional
    public void getAllAppClassesByCreateUserIsInShouldWork() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where createUser in DEFAULT_CREATE_USER or UPDATED_CREATE_USER
        defaultAppClassShouldBeFound("createUser.in=" + DEFAULT_CREATE_USER + "," + UPDATED_CREATE_USER);

        // Get all the appClassList where createUser equals to UPDATED_CREATE_USER
        defaultAppClassShouldNotBeFound("createUser.in=" + UPDATED_CREATE_USER);
    }

    @Test
    @Transactional
    public void getAllAppClassesByCreateUserIsNullOrNotNull() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where createUser is not null
        defaultAppClassShouldBeFound("createUser.specified=true");

        // Get all the appClassList where createUser is null
        defaultAppClassShouldNotBeFound("createUser.specified=false");
    }
                @Test
    @Transactional
    public void getAllAppClassesByCreateUserContainsSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where createUser contains DEFAULT_CREATE_USER
        defaultAppClassShouldBeFound("createUser.contains=" + DEFAULT_CREATE_USER);

        // Get all the appClassList where createUser contains UPDATED_CREATE_USER
        defaultAppClassShouldNotBeFound("createUser.contains=" + UPDATED_CREATE_USER);
    }

    @Test
    @Transactional
    public void getAllAppClassesByCreateUserNotContainsSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where createUser does not contain DEFAULT_CREATE_USER
        defaultAppClassShouldNotBeFound("createUser.doesNotContain=" + DEFAULT_CREATE_USER);

        // Get all the appClassList where createUser does not contain UPDATED_CREATE_USER
        defaultAppClassShouldBeFound("createUser.doesNotContain=" + UPDATED_CREATE_USER);
    }


    @Test
    @Transactional
    public void getAllAppClassesByUpdateUserIsEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where updateUser equals to DEFAULT_UPDATE_USER
        defaultAppClassShouldBeFound("updateUser.equals=" + DEFAULT_UPDATE_USER);

        // Get all the appClassList where updateUser equals to UPDATED_UPDATE_USER
        defaultAppClassShouldNotBeFound("updateUser.equals=" + UPDATED_UPDATE_USER);
    }

    @Test
    @Transactional
    public void getAllAppClassesByUpdateUserIsNotEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where updateUser not equals to DEFAULT_UPDATE_USER
        defaultAppClassShouldNotBeFound("updateUser.notEquals=" + DEFAULT_UPDATE_USER);

        // Get all the appClassList where updateUser not equals to UPDATED_UPDATE_USER
        defaultAppClassShouldBeFound("updateUser.notEquals=" + UPDATED_UPDATE_USER);
    }

    @Test
    @Transactional
    public void getAllAppClassesByUpdateUserIsInShouldWork() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where updateUser in DEFAULT_UPDATE_USER or UPDATED_UPDATE_USER
        defaultAppClassShouldBeFound("updateUser.in=" + DEFAULT_UPDATE_USER + "," + UPDATED_UPDATE_USER);

        // Get all the appClassList where updateUser equals to UPDATED_UPDATE_USER
        defaultAppClassShouldNotBeFound("updateUser.in=" + UPDATED_UPDATE_USER);
    }

    @Test
    @Transactional
    public void getAllAppClassesByUpdateUserIsNullOrNotNull() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where updateUser is not null
        defaultAppClassShouldBeFound("updateUser.specified=true");

        // Get all the appClassList where updateUser is null
        defaultAppClassShouldNotBeFound("updateUser.specified=false");
    }
                @Test
    @Transactional
    public void getAllAppClassesByUpdateUserContainsSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where updateUser contains DEFAULT_UPDATE_USER
        defaultAppClassShouldBeFound("updateUser.contains=" + DEFAULT_UPDATE_USER);

        // Get all the appClassList where updateUser contains UPDATED_UPDATE_USER
        defaultAppClassShouldNotBeFound("updateUser.contains=" + UPDATED_UPDATE_USER);
    }

    @Test
    @Transactional
    public void getAllAppClassesByUpdateUserNotContainsSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where updateUser does not contain DEFAULT_UPDATE_USER
        defaultAppClassShouldNotBeFound("updateUser.doesNotContain=" + DEFAULT_UPDATE_USER);

        // Get all the appClassList where updateUser does not contain UPDATED_UPDATE_USER
        defaultAppClassShouldBeFound("updateUser.doesNotContain=" + UPDATED_UPDATE_USER);
    }


    @Test
    @Transactional
    public void getAllAppClassesByCreateTimeIsEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where createTime equals to DEFAULT_CREATE_TIME
        defaultAppClassShouldBeFound("createTime.equals=" + DEFAULT_CREATE_TIME);

        // Get all the appClassList where createTime equals to UPDATED_CREATE_TIME
        defaultAppClassShouldNotBeFound("createTime.equals=" + UPDATED_CREATE_TIME);
    }

    @Test
    @Transactional
    public void getAllAppClassesByCreateTimeIsNotEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where createTime not equals to DEFAULT_CREATE_TIME
        defaultAppClassShouldNotBeFound("createTime.notEquals=" + DEFAULT_CREATE_TIME);

        // Get all the appClassList where createTime not equals to UPDATED_CREATE_TIME
        defaultAppClassShouldBeFound("createTime.notEquals=" + UPDATED_CREATE_TIME);
    }

    @Test
    @Transactional
    public void getAllAppClassesByCreateTimeIsInShouldWork() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where createTime in DEFAULT_CREATE_TIME or UPDATED_CREATE_TIME
        defaultAppClassShouldBeFound("createTime.in=" + DEFAULT_CREATE_TIME + "," + UPDATED_CREATE_TIME);

        // Get all the appClassList where createTime equals to UPDATED_CREATE_TIME
        defaultAppClassShouldNotBeFound("createTime.in=" + UPDATED_CREATE_TIME);
    }

    @Test
    @Transactional
    public void getAllAppClassesByCreateTimeIsNullOrNotNull() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where createTime is not null
        defaultAppClassShouldBeFound("createTime.specified=true");

        // Get all the appClassList where createTime is null
        defaultAppClassShouldNotBeFound("createTime.specified=false");
    }

    @Test
    @Transactional
    public void getAllAppClassesByUpdateTimeIsEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where updateTime equals to DEFAULT_UPDATE_TIME
        defaultAppClassShouldBeFound("updateTime.equals=" + DEFAULT_UPDATE_TIME);

        // Get all the appClassList where updateTime equals to UPDATED_UPDATE_TIME
        defaultAppClassShouldNotBeFound("updateTime.equals=" + UPDATED_UPDATE_TIME);
    }

    @Test
    @Transactional
    public void getAllAppClassesByUpdateTimeIsNotEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where updateTime not equals to DEFAULT_UPDATE_TIME
        defaultAppClassShouldNotBeFound("updateTime.notEquals=" + DEFAULT_UPDATE_TIME);

        // Get all the appClassList where updateTime not equals to UPDATED_UPDATE_TIME
        defaultAppClassShouldBeFound("updateTime.notEquals=" + UPDATED_UPDATE_TIME);
    }

    @Test
    @Transactional
    public void getAllAppClassesByUpdateTimeIsInShouldWork() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where updateTime in DEFAULT_UPDATE_TIME or UPDATED_UPDATE_TIME
        defaultAppClassShouldBeFound("updateTime.in=" + DEFAULT_UPDATE_TIME + "," + UPDATED_UPDATE_TIME);

        // Get all the appClassList where updateTime equals to UPDATED_UPDATE_TIME
        defaultAppClassShouldNotBeFound("updateTime.in=" + UPDATED_UPDATE_TIME);
    }

    @Test
    @Transactional
    public void getAllAppClassesByUpdateTimeIsNullOrNotNull() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where updateTime is not null
        defaultAppClassShouldBeFound("updateTime.specified=true");

        // Get all the appClassList where updateTime is null
        defaultAppClassShouldNotBeFound("updateTime.specified=false");
    }

    @Test
    @Transactional
    public void getAllAppClassesByEnabledIsEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where enabled equals to DEFAULT_ENABLED
        defaultAppClassShouldBeFound("enabled.equals=" + DEFAULT_ENABLED);

        // Get all the appClassList where enabled equals to UPDATED_ENABLED
        defaultAppClassShouldNotBeFound("enabled.equals=" + UPDATED_ENABLED);
    }

    @Test
    @Transactional
    public void getAllAppClassesByEnabledIsNotEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where enabled not equals to DEFAULT_ENABLED
        defaultAppClassShouldNotBeFound("enabled.notEquals=" + DEFAULT_ENABLED);

        // Get all the appClassList where enabled not equals to UPDATED_ENABLED
        defaultAppClassShouldBeFound("enabled.notEquals=" + UPDATED_ENABLED);
    }

    @Test
    @Transactional
    public void getAllAppClassesByEnabledIsInShouldWork() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where enabled in DEFAULT_ENABLED or UPDATED_ENABLED
        defaultAppClassShouldBeFound("enabled.in=" + DEFAULT_ENABLED + "," + UPDATED_ENABLED);

        // Get all the appClassList where enabled equals to UPDATED_ENABLED
        defaultAppClassShouldNotBeFound("enabled.in=" + UPDATED_ENABLED);
    }

    @Test
    @Transactional
    public void getAllAppClassesByEnabledIsNullOrNotNull() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        // Get all the appClassList where enabled is not null
        defaultAppClassShouldBeFound("enabled.specified=true");

        // Get all the appClassList where enabled is null
        defaultAppClassShouldNotBeFound("enabled.specified=false");
    }

    @Test
    @Transactional
    public void getAllAppClassesByWebConfigIsEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);
        WebConfig webConfig = WebConfigResourceIT.createEntity(em);
        em.persist(webConfig);
        em.flush();
        appClass.setWebConfig(webConfig);
        appClassRepository.saveAndFlush(appClass);
        Long webConfigId = webConfig.getId();

        // Get all the appClassList where webConfig equals to webConfigId
        defaultAppClassShouldBeFound("webConfigId.equals=" + webConfigId);

        // Get all the appClassList where webConfig equals to webConfigId + 1
        defaultAppClassShouldNotBeFound("webConfigId.equals=" + (webConfigId + 1));
    }


    @Test
    @Transactional
    public void getAllAppClassesByPageSchemaIsEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);
        PageSchema pageSchema = PageSchemaResourceIT.createEntity(em);
        em.persist(pageSchema);
        em.flush();
        appClass.addPageSchema(pageSchema);
        appClassRepository.saveAndFlush(appClass);
        Long pageSchemaId = pageSchema.getId();

        // Get all the appClassList where pageSchema equals to pageSchemaId
        defaultAppClassShouldBeFound("pageSchemaId.equals=" + pageSchemaId);

        // Get all the appClassList where pageSchema equals to pageSchemaId + 1
        defaultAppClassShouldNotBeFound("pageSchemaId.equals=" + (pageSchemaId + 1));
    }


    @Test
    @Transactional
    public void getAllAppClassesByProjectClassIsEqualToSomething() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);
        ProjectClass projectClass = ProjectClassResourceIT.createEntity(em);
        em.persist(projectClass);
        em.flush();
        appClass.setProjectClass(projectClass);
        appClassRepository.saveAndFlush(appClass);
        Long projectClassId = projectClass.getId();

        // Get all the appClassList where projectClass equals to projectClassId
        defaultAppClassShouldBeFound("projectClassId.equals=" + projectClassId);

        // Get all the appClassList where projectClass equals to projectClassId + 1
        defaultAppClassShouldNotBeFound("projectClassId.equals=" + (projectClassId + 1));
    }

    /**
     * Executes the search, and checks that the default entity is returned.
     */
    private void defaultAppClassShouldBeFound(String filter) throws Exception {
        restAppClassMockMvc.perform(get("/api/app-classes?sort=id,desc&" + filter))
            .andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
            .andExpect(jsonPath("$.[*].id").value(hasItem(appClass.getId().intValue())))
            .andExpect(jsonPath("$.[*].comment").value(hasItem(DEFAULT_COMMENT)))
            .andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME)))
            .andExpect(jsonPath("$.[*].status").value(hasItem(DEFAULT_STATUS)))
            .andExpect(jsonPath("$.[*].enableSystemTable").value(hasItem(DEFAULT_ENABLE_SYSTEM_TABLE.booleanValue())))
            .andExpect(jsonPath("$.[*].x").value(hasItem(DEFAULT_X.intValue())))
            .andExpect(jsonPath("$.[*].y").value(hasItem(DEFAULT_Y.intValue())))
            .andExpect(jsonPath("$.[*].description").value(hasItem(DEFAULT_DESCRIPTION.toString())))
            .andExpect(jsonPath("$.[*].tenantId").value(hasItem(DEFAULT_TENANT_ID.intValue())))
            .andExpect(jsonPath("$.[*].createUser").value(hasItem(DEFAULT_CREATE_USER)))
            .andExpect(jsonPath("$.[*].updateUser").value(hasItem(DEFAULT_UPDATE_USER)))
            .andExpect(jsonPath("$.[*].createTime").value(hasItem(DEFAULT_CREATE_TIME.toString())))
            .andExpect(jsonPath("$.[*].updateTime").value(hasItem(DEFAULT_UPDATE_TIME.toString())))
            .andExpect(jsonPath("$.[*].enabled").value(hasItem(DEFAULT_ENABLED.booleanValue())));

        // Check, that the count call also returns 1
        restAppClassMockMvc.perform(get("/api/app-classes/count?sort=id,desc&" + filter))
            .andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
            .andExpect(content().string("1"));
    }

    /**
     * Executes the search, and checks that the default entity is not returned.
     */
    private void defaultAppClassShouldNotBeFound(String filter) throws Exception {
        restAppClassMockMvc.perform(get("/api/app-classes?sort=id,desc&" + filter))
            .andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
            .andExpect(jsonPath("$").isArray())
            .andExpect(jsonPath("$").isEmpty());

        // Check, that the count call also returns 0
        restAppClassMockMvc.perform(get("/api/app-classes/count?sort=id,desc&" + filter))
            .andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
            .andExpect(content().string("0"));
    }

    @Test
    @Transactional
    public void getNonExistingAppClass() throws Exception {
        // Get the appClass
        restAppClassMockMvc.perform(get("/api/app-classes/{id}", Long.MAX_VALUE))
            .andExpect(status().isNotFound());
    }

    @Test
    @Transactional
    public void updateAppClass() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        int databaseSizeBeforeUpdate = appClassRepository.findAll().size();

        // Update the appClass
        AppClass updatedAppClass = appClassRepository.findById(appClass.getId()).get();
        // Disconnect from session so that the updates on updatedAppClass are not directly saved in db
        em.detach(updatedAppClass);
        updatedAppClass
            .comment(UPDATED_COMMENT)
            .name(UPDATED_NAME)
            .status(UPDATED_STATUS)
            .enableSystemTable(UPDATED_ENABLE_SYSTEM_TABLE)
            .x(UPDATED_X)
            .y(UPDATED_Y)
            .description(UPDATED_DESCRIPTION)
            .tenantId(UPDATED_TENANT_ID)
            .createUser(UPDATED_CREATE_USER)
            .updateUser(UPDATED_UPDATE_USER)
            .createTime(UPDATED_CREATE_TIME)
            .updateTime(UPDATED_UPDATE_TIME)
            .enabled(UPDATED_ENABLED);
        AppClassDTO appClassDTO = appClassMapper.toDto(updatedAppClass);

        restAppClassMockMvc.perform(put("/api/app-classes").with(csrf())
            .contentType(MediaType.APPLICATION_JSON)
            .content(TestUtil.convertObjectToJsonBytes(appClassDTO)))
            .andExpect(status().isOk());

        // Validate the AppClass in the database
        List<AppClass> appClassList = appClassRepository.findAll();
        assertThat(appClassList).hasSize(databaseSizeBeforeUpdate);
        AppClass testAppClass = appClassList.get(appClassList.size() - 1);
        assertThat(testAppClass.getComment()).isEqualTo(UPDATED_COMMENT);
        assertThat(testAppClass.getName()).isEqualTo(UPDATED_NAME);
        assertThat(testAppClass.getStatus()).isEqualTo(UPDATED_STATUS);
        assertThat(testAppClass.isEnableSystemTable()).isEqualTo(UPDATED_ENABLE_SYSTEM_TABLE);
        assertThat(testAppClass.getX()).isEqualTo(UPDATED_X);
        assertThat(testAppClass.getY()).isEqualTo(UPDATED_Y);
        assertThat(testAppClass.getDescription()).isEqualTo(UPDATED_DESCRIPTION);
        assertThat(testAppClass.getTenantId()).isEqualTo(UPDATED_TENANT_ID);
        assertThat(testAppClass.getCreateUser()).isEqualTo(UPDATED_CREATE_USER);
        assertThat(testAppClass.getUpdateUser()).isEqualTo(UPDATED_UPDATE_USER);
        assertThat(testAppClass.getCreateTime()).isEqualTo(UPDATED_CREATE_TIME);
        assertThat(testAppClass.getUpdateTime()).isEqualTo(UPDATED_UPDATE_TIME);
        assertThat(testAppClass.isEnabled()).isEqualTo(UPDATED_ENABLED);
    }

    @Test
    @Transactional
    public void updateNonExistingAppClass() throws Exception {
        int databaseSizeBeforeUpdate = appClassRepository.findAll().size();

        // Create the AppClass
        AppClassDTO appClassDTO = appClassMapper.toDto(appClass);

        // If the entity doesn't have an ID, it will throw BadRequestAlertException
        restAppClassMockMvc.perform(put("/api/app-classes").with(csrf())
            .contentType(MediaType.APPLICATION_JSON)
            .content(TestUtil.convertObjectToJsonBytes(appClassDTO)))
            .andExpect(status().isBadRequest());

        // Validate the AppClass in the database
        List<AppClass> appClassList = appClassRepository.findAll();
        assertThat(appClassList).hasSize(databaseSizeBeforeUpdate);
    }

    @Test
    @Transactional
    public void deleteAppClass() throws Exception {
        // Initialize the database
        appClassRepository.saveAndFlush(appClass);

        int databaseSizeBeforeDelete = appClassRepository.findAll().size();

        // Delete the appClass
        restAppClassMockMvc.perform(delete("/api/app-classes/{id}", appClass.getId()).with(csrf())
            .accept(MediaType.APPLICATION_JSON))
            .andExpect(status().isNoContent());

        // Validate the database contains one less item
        List<AppClass> appClassList = appClassRepository.findAll();
        assertThat(appClassList).hasSize(databaseSizeBeforeDelete - 1);
    }
}
